perm filename A38[106,RWF] blob
sn#745904 filedate 1984-03-30 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 ∂24-Oct-83 1003 VIOLETTA@SU-SCORE.ARPA handout#11
C00004 00003 ∂24-Oct-83 1004 VIOLETTA@SU-SCORE.ARPA handout#12
C00008 ENDMK
C⊗;
∂24-Oct-83 1003 VIOLETTA@SU-SCORE.ARPA handout#11
Received: from SU-SCORE by SU-AI with TCP/SMTP; 24 Oct 83 10:03:31 PDT
Date: Mon 24 Oct 83 10:05:20-PDT
From: Violetta Cavalli-Sf <VIOLETTA@SU-SCORE.ARPA>
Subject: handout#11
To: rfn@SU-AI.ARPA
cc: violetta@SU-SCORE.ARPA
CS106-3 Prof. Floyd Handout #11
SAMPLE PROGRAM
program PinWheel(output);
const Size = 10;
var Col, Row : integer;
begin (* PinWheel *)
for Row:= - Size to Size do begin
for Col:= -Size to Size do
if (Col * Row * (ABS(Col) - ABS(Row))) >= 0 then write('*')
else write(' ');
writeln;
end;
end. (* PinWheel *)
* ***********
** **********
*** *********
**** ********
***** *******
****** ******
******* *****
******** ****
********* ***
************
*********************
************
*** *********
**** ********
***** *******
****** ******
******* *****
******** ****
********* ***
********** **
*********** *
-------
∂24-Oct-83 1004 VIOLETTA@SU-SCORE.ARPA handout#12
Received: from SU-SCORE by SU-AI with TCP/SMTP; 24 Oct 83 10:04:26 PDT
Date: Mon 24 Oct 83 10:06:16-PDT
From: Violetta Cavalli-Sf <VIOLETTA@SU-SCORE.ARPA>
Subject: handout#12
To: rfn@SU-AI.ARPA
cc: violetta@SU-SCORE.ARPA
CS106-3 Prof. Floyd Handout #12
SAMPLE SOLUTION TO ASSIGNMENT #4
program ExactExpressions(input,output);
(*****************************************************************
This program calculates the first 10 powers of the expression
(A + B * SQRT(5))
giving the results in terms of integer values and SQRT(5)
*****************************************************************)
var A, B, C, D, SaveC : integer;
Count : integer;
begin (* Exact Expressions *)
(* Input *)
write('Enter coefficients A and B separated by a space: ');
read(A,B);
writeln; writeln;
(* Initialization *)
C:= A; D:= B;
(* Calculations and Output *)
for Count:= 1 to 10 do begin
writeln(C:10,' + ',D:10,' * SQRT(5)');
SaveC:= C;
C:= A*C + 5*B*D;
D:= A*D + SaveC*B;
end;
end. (* ExactExpressions *)
@exec exact
Stanford LOTS/Passgo 20 [EXACTE] -- 1..
Runtime: 0: 0.185
[EXACTE execution]
INPUT : tty:
OUTPUT : tty:
[INPUT, end with ↑Z: ]
Enter coefficients A and B separated by a space: 3 1
3 + 1 * SQRT(5)
14 + 6 * SQRT(5)
72 + 32 * SQRT(5)
376 + 168 * SQRT(5)
1968 + 880 * SQRT(5)
10304 + 4608 * SQRT(5)
53952 + 24128 * SQRT(5)
282496 + 126336 * SQRT(5)
1479168 + 661504 * SQRT(5)
7745024 + 3463680 * SQRT(5)
-------